@remarkablejames/editor 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +62 -0
- package/lib/ActionMenuButton-B0EHT9CC.js +35 -0
- package/lib/ActionMenuButton-J1el_e6Z.cjs +1 -0
- package/lib/Attachment.cjs +19 -0
- package/lib/Attachment.js +273 -0
- package/lib/Blockquote.cjs +5 -0
- package/lib/Blockquote.js +107 -0
- package/lib/Bold.cjs +1 -0
- package/lib/Bold.js +123 -0
- package/lib/BulletList.cjs +1 -0
- package/lib/BulletList.js +53 -0
- package/lib/Callout.cjs +1 -0
- package/lib/Callout.js +225 -0
- package/lib/Clear.cjs +1 -0
- package/lib/Clear.js +49 -0
- package/lib/Code.cjs +1 -0
- package/lib/Code.js +100 -0
- package/lib/CodeBlock.cjs +44 -0
- package/lib/CodeBlock.js +4065 -0
- package/lib/CodeView.cjs +1 -0
- package/lib/CodeView.js +81 -0
- package/lib/Color.cjs +1 -0
- package/lib/Color.js +134 -0
- package/lib/Column.cjs +1 -0
- package/lib/Column.js +230 -0
- package/lib/Drawer-BCWVN-4l.js +1125 -0
- package/lib/Drawer-BTouEroZ.cjs +2 -0
- package/lib/Drawer.cjs +1 -0
- package/lib/Drawer.js +7 -0
- package/lib/Emoji.cjs +1 -0
- package/lib/Emoji.js +19888 -0
- package/lib/Excalidraw.cjs +1 -0
- package/lib/Excalidraw.js +276 -0
- package/lib/ExportPdf.cjs +39 -0
- package/lib/ExportPdf.js +142 -0
- package/lib/ExportWord.cjs +1 -0
- package/lib/ExportWord.js +107 -0
- package/lib/FontFamily.cjs +1 -0
- package/lib/FontFamily.js +84 -0
- package/lib/FontSize.cjs +1 -0
- package/lib/FontSize.js +106 -0
- package/lib/Heading.cjs +1 -0
- package/lib/Heading.js +167 -0
- package/lib/Highlight.cjs +1 -0
- package/lib/Highlight.js +203 -0
- package/lib/History.cjs +1 -0
- package/lib/History.js +990 -0
- package/lib/HorizontalRule.cjs +1 -0
- package/lib/HorizontalRule.js +118 -0
- package/lib/Iframe-BdgiWGml.js +416 -0
- package/lib/Iframe-BfBLILDA.cjs +1 -0
- package/lib/Iframe.cjs +1 -0
- package/lib/Iframe.js +7 -0
- package/lib/Image.cjs +1 -0
- package/lib/Image.js +6 -0
- package/lib/ImageGif.cjs +1 -0
- package/lib/ImageGif.js +400 -0
- package/lib/ImportWord.cjs +1 -0
- package/lib/ImportWord.js +145 -0
- package/lib/Indent-BpMcZKok.js +148 -0
- package/lib/Indent-Dvqz_WEn.cjs +1 -0
- package/lib/Indent.cjs +1 -0
- package/lib/Indent.js +6 -0
- package/lib/Italic.cjs +1 -0
- package/lib/Italic.js +123 -0
- package/lib/Katex-B8_uprkO.js +2753 -0
- package/lib/Katex-BQyeCeQ0.cjs +4 -0
- package/lib/Katex.cjs +1 -0
- package/lib/Katex.js +6 -0
- package/lib/LineHeight.cjs +1 -0
- package/lib/LineHeight.js +89 -0
- package/lib/Link.cjs +1 -0
- package/lib/Link.js +6 -0
- package/lib/LinkEditBlock-BX0fXXpF.js +1185 -0
- package/lib/LinkEditBlock-CIshn_8F.cjs +5 -0
- package/lib/Mention.cjs +1 -0
- package/lib/Mention.js +265 -0
- package/lib/Mermaid-0GiGVxn0.cjs +2 -0
- package/lib/Mermaid-D8bbIgAl.js +381 -0
- package/lib/Mermaid.cjs +1 -0
- package/lib/Mermaid.js +7 -0
- package/lib/MoreMark.cjs +1 -0
- package/lib/MoreMark.js +157 -0
- package/lib/OrderedList.cjs +1 -0
- package/lib/OrderedList.js +52 -0
- package/lib/SearchAndReplace.cjs +1 -0
- package/lib/SearchAndReplace.js +305 -0
- package/lib/SlashCommand.cjs +1 -0
- package/lib/SlashCommand.js +90 -0
- package/lib/SlashCommandNodeView-BcmtKbEE.js +249 -0
- package/lib/SlashCommandNodeView-rDJ7OjRd.cjs +1 -0
- package/lib/Strike.cjs +1 -0
- package/lib/Strike.js +112 -0
- package/lib/Table-BEhNBeuA.cjs +5 -0
- package/lib/Table-DbxuP5xh.js +1939 -0
- package/lib/Table.cjs +1 -0
- package/lib/Table.js +5 -0
- package/lib/TaskList.cjs +1 -0
- package/lib/TaskList.js +63 -0
- package/lib/TextAlign.cjs +1 -0
- package/lib/TextAlign.js +165 -0
- package/lib/TextDirection.cjs +1 -0
- package/lib/TextDirection.js +110 -0
- package/lib/TextUnderline.cjs +1 -0
- package/lib/TextUnderline.js +115 -0
- package/lib/Twitter-9I6BLNmg.js +1666 -0
- package/lib/Twitter-BuEBgpi9.cjs +1 -0
- package/lib/Twitter.cjs +1 -0
- package/lib/Twitter.js +6 -0
- package/lib/Video.cjs +1 -0
- package/lib/Video.js +7 -0
- package/lib/bubble.cjs +3 -0
- package/lib/bubble.d.ts +1 -0
- package/lib/bubble.js +9533 -0
- package/lib/clsx-CDyrfCnw.js +7391 -0
- package/lib/clsx-CXbNJWDD.cjs +54 -0
- package/lib/components/ActionButton.d.ts +23 -0
- package/lib/components/ActionMenuButton.d.ts +28 -0
- package/lib/components/Bubble/RichTextBubbleCallout.d.ts +1 -0
- package/lib/components/Bubble/RichTextBubbleColumns.d.ts +1 -0
- package/lib/components/Bubble/RichTextBubbleDrawer.d.ts +1 -0
- package/lib/components/Bubble/RichTextBubbleExcalidraw.d.ts +1 -0
- package/lib/components/Bubble/RichTextBubbleIframe.d.ts +1 -0
- package/lib/components/Bubble/RichTextBubbleKatex.d.ts +1 -0
- package/lib/components/Bubble/RichTextBubbleLink.d.ts +6 -0
- package/lib/components/Bubble/RichTextBubbleMedia.d.ts +4 -0
- package/lib/components/Bubble/RichTextBubbleMenuDragHandle.d.ts +1 -0
- package/lib/components/Bubble/RichTextBubbleMermaid.d.ts +1 -0
- package/lib/components/Bubble/RichTextBubbleTable.d.ts +5 -0
- package/lib/components/Bubble/RichTextBubbleText.d.ts +5 -0
- package/lib/components/Bubble/RichTextBubbleTwitter.d.ts +1 -0
- package/lib/components/Bubble/formatBubble.d.ts +55 -0
- package/lib/components/Bubble/index.d.ts +13 -0
- package/lib/components/ColorPicker.d.ts +11 -0
- package/lib/components/ReactBus.d.ts +11 -0
- package/lib/components/RichTextProvider.d.ts +8 -0
- package/lib/components/SizeSetter/SizeSetter.d.ts +13 -0
- package/lib/components/SlashDialogTrigger/RenderDialogUploadImage.d.ts +1 -0
- package/lib/components/SlashDialogTrigger/RenderDialogUploadVideo.d.ts +1 -0
- package/lib/components/SlashDialogTrigger/SlashDialogTrigger.d.ts +5 -0
- package/lib/components/icons/Activity.d.ts +2 -0
- package/lib/components/icons/Animas.d.ts +2 -0
- package/lib/components/icons/AspectRatio.d.ts +2 -0
- package/lib/components/icons/Blockquote.d.ts +2 -0
- package/lib/components/icons/CodeView.d.ts +1 -0
- package/lib/components/icons/ColumnAddLeft.d.ts +1 -0
- package/lib/components/icons/ColumnAddRight.d.ts +1 -0
- package/lib/components/icons/DeleteColumn.d.ts +2 -0
- package/lib/components/icons/DeleteRow.d.ts +2 -0
- package/lib/components/icons/Direction.d.ts +1 -0
- package/lib/components/icons/Excalidraw.d.ts +1 -0
- package/lib/components/icons/ExportPdf.d.ts +1 -0
- package/lib/components/icons/ExportWord.d.ts +2 -0
- package/lib/components/icons/FileWordOutline.d.ts +2 -0
- package/lib/components/icons/Flag.d.ts +2 -0
- package/lib/components/icons/Food.d.ts +2 -0
- package/lib/components/icons/GIfIcon.d.ts +1 -0
- package/lib/components/icons/Html.d.ts +1 -0
- package/lib/components/icons/Icon.d.ts +8 -0
- package/lib/components/icons/IconColorFill.d.ts +5 -0
- package/lib/components/icons/IconHighlightFill.d.ts +3 -0
- package/lib/components/icons/ImportWord.d.ts +2 -0
- package/lib/components/icons/LeftToRight.d.ts +1 -0
- package/lib/components/icons/LineHeight.d.ts +2 -0
- package/lib/components/icons/MenuDown.d.ts +2 -0
- package/lib/components/icons/Mermaid.d.ts +1 -0
- package/lib/components/icons/NoFill.d.ts +1 -0
- package/lib/components/icons/Object.d.ts +2 -0
- package/lib/components/icons/RightToLeft.d.ts +1 -0
- package/lib/components/icons/SizeL.d.ts +2 -0
- package/lib/components/icons/SizeM.d.ts +2 -0
- package/lib/components/icons/SizeS.d.ts +2 -0
- package/lib/components/icons/Symbol.d.ts +2 -0
- package/lib/components/icons/Travel.d.ts +2 -0
- package/lib/components/icons/Twitter.d.ts +1 -0
- package/lib/components/icons/icons.d.ts +1 -0
- package/lib/components/icons/index.d.ts +12 -0
- package/lib/components/index.d.ts +6 -0
- package/lib/components/ui/button.d.ts +11 -0
- package/lib/components/ui/checkbox.d.ts +4 -0
- package/lib/components/ui/dialog.d.ts +19 -0
- package/lib/components/ui/dropdown-menu.d.ts +27 -0
- package/lib/components/ui/emoji-picker.d.ts +7 -0
- package/lib/components/ui/index.d.ts +15 -0
- package/lib/components/ui/input.d.ts +5 -0
- package/lib/components/ui/label.d.ts +5 -0
- package/lib/components/ui/popover.d.ts +6 -0
- package/lib/components/ui/select.d.ts +13 -0
- package/lib/components/ui/separator.d.ts +4 -0
- package/lib/components/ui/switch.d.ts +4 -0
- package/lib/components/ui/tabs.d.ts +7 -0
- package/lib/components/ui/textarea.d.ts +5 -0
- package/lib/components/ui/toast.d.ts +15 -0
- package/lib/components/ui/toaster.d.ts +1 -0
- package/lib/components/ui/toggle.d.ts +12 -0
- package/lib/components/ui/tooltip.d.ts +7 -0
- package/lib/components/ui/use-toast.d.ts +44 -0
- package/lib/constants/index.d.ts +47 -0
- package/lib/constants/resetCSS.d.ts +1 -0
- package/lib/delete-node-CosiBes5.cjs +1 -0
- package/lib/delete-node-eQHsyyhR.js +24 -0
- package/lib/dom-dataset-BqoJhJXt.cjs +1 -0
- package/lib/dom-dataset-CIEeltF6.js +47 -0
- package/lib/dropdown-menu-Bs69ZBbO.js +143 -0
- package/lib/dropdown-menu-DjWlG2-J.cjs +1 -0
- package/lib/extensions/Attachment/Attachment.d.ts +15 -0
- package/lib/extensions/Attachment/components/NodeViewAttachment/FileIcon.d.ts +1 -0
- package/lib/extensions/Attachment/components/NodeViewAttachment/FileIconString.d.ts +1 -0
- package/lib/extensions/Attachment/components/NodeViewAttachment/NodeViewAttachment.d.ts +1 -0
- package/lib/extensions/Attachment/components/RichTextAttachment.d.ts +1 -0
- package/lib/extensions/Attachment/index.d.ts +1 -0
- package/lib/extensions/Blockquote/Blockquote.d.ts +6 -0
- package/lib/extensions/Blockquote/components/RichTextBlockquote.d.ts +1 -0
- package/lib/extensions/Blockquote/index.d.ts +1 -0
- package/lib/extensions/Bold/Bold.d.ts +6 -0
- package/lib/extensions/Bold/components/RichTextBold.d.ts +1 -0
- package/lib/extensions/Bold/index.d.ts +1 -0
- package/lib/extensions/BulletList/BulletList.d.ts +6 -0
- package/lib/extensions/BulletList/components/RichTextBulletList.d.ts +1 -0
- package/lib/extensions/BulletList/index.d.ts +1 -0
- package/lib/extensions/Callout/Callout.d.ts +18 -0
- package/lib/extensions/Callout/components/NodeViewCallout/NodeViewCallout.d.ts +1 -0
- package/lib/extensions/Callout/components/RichTextCallout.d.ts +1 -0
- package/lib/extensions/Callout/index.d.ts +1 -0
- package/lib/extensions/Clear/Clear.d.ts +6 -0
- package/lib/extensions/Clear/components/RichTextClear.d.ts +1 -0
- package/lib/extensions/Clear/index.d.ts +1 -0
- package/lib/extensions/Code/Code.d.ts +6 -0
- package/lib/extensions/Code/components/RichTextCode.d.ts +1 -0
- package/lib/extensions/Code/index.d.ts +1 -0
- package/lib/extensions/CodeBlock/CodeBlock.d.ts +21 -0
- package/lib/extensions/CodeBlock/components/NodeViewCodeBlock/NodeViewCodeBlock.d.ts +1 -0
- package/lib/extensions/CodeBlock/components/RichTextCodeBlock.d.ts +1 -0
- package/lib/extensions/CodeBlock/index.d.ts +1 -0
- package/lib/extensions/CodeView/CodeView.d.ts +17 -0
- package/lib/extensions/CodeView/components/RichTextCodeView.d.ts +1 -0
- package/lib/extensions/CodeView/index.d.ts +1 -0
- package/lib/extensions/Color/Color.d.ts +22 -0
- package/lib/extensions/Color/components/RichTextColor.d.ts +1 -0
- package/lib/extensions/Color/index.d.ts +1 -0
- package/lib/extensions/Column/Column.d.ts +17 -0
- package/lib/extensions/Column/components/RichTextColumn.d.ts +1 -0
- package/lib/extensions/Column/index.d.ts +1 -0
- package/lib/extensions/Drawer/Drawer.d.ts +15 -0
- package/lib/extensions/Drawer/components/ControlDrawer/ControlDrawer.d.ts +2 -0
- package/lib/extensions/Drawer/components/ControlDrawer/icon.d.ts +28 -0
- package/lib/extensions/Drawer/components/EditDrawerBlock.d.ts +1 -0
- package/lib/extensions/Drawer/components/NodeViewDrawer/NodeViewDrawer.d.ts +1 -0
- package/lib/extensions/Drawer/components/RichTextDrawer.d.ts +1 -0
- package/lib/extensions/Drawer/index.d.ts +1 -0
- package/lib/extensions/Emoji/Emoji.d.ts +5 -0
- package/lib/extensions/Emoji/components/EmojiList/EmojiNodeView.d.ts +11 -0
- package/lib/extensions/Emoji/components/RichTextEmoji.d.ts +1 -0
- package/lib/extensions/Emoji/index.d.ts +1 -0
- package/lib/extensions/Excalidraw/Excalidraw.d.ts +17 -0
- package/lib/extensions/Excalidraw/components/NodeViewExcalidraw/NodeViewExcalidraw.d.ts +2 -0
- package/lib/extensions/Excalidraw/components/RichTextExcalidraw.d.ts +1 -0
- package/lib/extensions/Excalidraw/index.d.ts +1 -0
- package/lib/extensions/ExportPdf/ExportPdf.d.ts +21 -0
- package/lib/extensions/ExportPdf/components/RichTextExportPdf.d.ts +1 -0
- package/lib/extensions/ExportPdf/index.d.ts +1 -0
- package/lib/extensions/ExportWord/ExportWord.d.ts +13 -0
- package/lib/extensions/ExportWord/components/RichTextExportWord.d.ts +1 -0
- package/lib/extensions/ExportWord/index.d.ts +1 -0
- package/lib/extensions/FontFamily/FontFamily.d.ts +10 -0
- package/lib/extensions/FontFamily/components/RichTextFontFamily.d.ts +15 -0
- package/lib/extensions/FontFamily/index.d.ts +1 -0
- package/lib/extensions/FontSize/FontSize.d.ts +32 -0
- package/lib/extensions/FontSize/components/RichTextFontSize.d.ts +12 -0
- package/lib/extensions/FontSize/index.d.ts +1 -0
- package/lib/extensions/Heading/Heading.d.ts +6 -0
- package/lib/extensions/Heading/components/RichTextHeading.d.ts +15 -0
- package/lib/extensions/Heading/index.d.ts +1 -0
- package/lib/extensions/Highlight/Highlight.d.ts +18 -0
- package/lib/extensions/Highlight/components/RichTextHighlight.d.ts +1 -0
- package/lib/extensions/Highlight/index.d.ts +1 -0
- package/lib/extensions/History/History.d.ts +6 -0
- package/lib/extensions/History/components/RichTextHistory.d.ts +2 -0
- package/lib/extensions/History/index.d.ts +1 -0
- package/lib/extensions/HorizontalRule/HorizontalRule.d.ts +6 -0
- package/lib/extensions/HorizontalRule/components/RichTextHorizontalRule.d.ts +1 -0
- package/lib/extensions/HorizontalRule/index.d.ts +1 -0
- package/lib/extensions/Iframe/Iframe.d.ts +16 -0
- package/lib/extensions/Iframe/components/IframeNodeView.d.ts +2 -0
- package/lib/extensions/Iframe/components/RichTextIframe.d.ts +1 -0
- package/lib/extensions/Iframe/index.d.ts +1 -0
- package/lib/extensions/Iframe/utils.d.ts +9 -0
- package/lib/extensions/Image/Image.d.ts +64 -0
- package/lib/extensions/Image/components/ImageCropper.d.ts +1 -0
- package/lib/extensions/Image/components/ImageView.d.ts +2 -0
- package/lib/extensions/Image/components/RichTextImage.d.ts +1 -0
- package/lib/extensions/Image/index.d.ts +1 -0
- package/lib/extensions/ImageGif/ImageGif.d.ts +39 -0
- package/lib/extensions/ImageGif/components/ImageGifView.d.ts +2 -0
- package/lib/extensions/ImageGif/components/RichTextImageGif.d.ts +1 -0
- package/lib/extensions/ImageGif/components/services.d.ts +458 -0
- package/lib/extensions/ImageGif/index.d.ts +1 -0
- package/lib/extensions/ImportWord/ImportWord.d.ts +18 -0
- package/lib/extensions/ImportWord/components/RichTextImportWord.d.ts +1 -0
- package/lib/extensions/ImportWord/index.d.ts +1 -0
- package/lib/extensions/Indent/Indent.d.ts +23 -0
- package/lib/extensions/Indent/components/RichTextIndent.d.ts +1 -0
- package/lib/extensions/Indent/index.d.ts +1 -0
- package/lib/extensions/Italic/Italic.d.ts +6 -0
- package/lib/extensions/Italic/components/RichTextItalic.d.ts +1 -0
- package/lib/extensions/Italic/index.d.ts +1 -0
- package/lib/extensions/Katex/Katex.d.ts +17 -0
- package/lib/extensions/Katex/components/KatexWrapper.d.ts +1 -0
- package/lib/extensions/Katex/components/RichTextKatex.d.ts +1 -0
- package/lib/extensions/Katex/index.d.ts +1 -0
- package/lib/extensions/LineHeight/LineHeight.d.ts +7 -0
- package/lib/extensions/LineHeight/components/RichTextLightHeight.d.ts +1 -0
- package/lib/extensions/LineHeight/index.d.ts +1 -0
- package/lib/extensions/Link/Link.d.ts +6 -0
- package/lib/extensions/Link/components/LinkEditBlock.d.ts +9 -0
- package/lib/extensions/Link/components/LinkViewBlock.d.ts +8 -0
- package/lib/extensions/Link/components/RichTextLink.d.ts +1 -0
- package/lib/extensions/Link/index.d.ts +1 -0
- package/lib/extensions/Mention/Mention.d.ts +3 -0
- package/lib/extensions/Mention/components/NodeViewMentionList.d.ts +16 -0
- package/lib/extensions/Mention/index.d.ts +1 -0
- package/lib/extensions/Mermaid/Mermaid.d.ts +27 -0
- package/lib/extensions/Mermaid/components/EditMermaidBlock.d.ts +9 -0
- package/lib/extensions/Mermaid/components/NodeViewMermaid/NodeViewMermaid.d.ts +9 -0
- package/lib/extensions/Mermaid/components/RichTextMermaid.d.ts +1 -0
- package/lib/extensions/Mermaid/index.d.ts +1 -0
- package/lib/extensions/MoreMark/MoreMark.d.ts +20 -0
- package/lib/extensions/MoreMark/components/RichTextMoreMark.d.ts +14 -0
- package/lib/extensions/MoreMark/index.d.ts +1 -0
- package/lib/extensions/OrderedList/OrderedList.d.ts +6 -0
- package/lib/extensions/OrderedList/components/RichTextOrderedList.d.ts +1 -0
- package/lib/extensions/OrderedList/index.d.ts +1 -0
- package/lib/extensions/SearchAndReplace/SearchAndReplace.d.ts +36 -0
- package/lib/extensions/SearchAndReplace/components/RichTextSearchAndReplace.d.ts +1 -0
- package/lib/extensions/SearchAndReplace/index.d.ts +1 -0
- package/lib/extensions/SlashCommand/SlashCommand.d.ts +4 -0
- package/lib/extensions/SlashCommand/components/SlashCommandList.d.ts +6 -0
- package/lib/extensions/SlashCommand/components/SlashCommandNodeView.d.ts +3 -0
- package/lib/extensions/SlashCommand/index.d.ts +1 -0
- package/lib/extensions/SlashCommand/renderCommandListDefault.d.ts +7 -0
- package/lib/extensions/SlashCommand/types.d.ts +20 -0
- package/lib/extensions/Strike/Strike.d.ts +6 -0
- package/lib/extensions/Strike/components/RichTextStrike.d.ts +1 -0
- package/lib/extensions/Strike/index.d.ts +1 -0
- package/lib/extensions/Table/Table.d.ts +21 -0
- package/lib/extensions/Table/TableCellBackground.d.ts +14 -0
- package/lib/extensions/Table/components/CreateTablePopover.d.ts +7 -0
- package/lib/extensions/Table/components/RichTextTable.d.ts +1 -0
- package/lib/extensions/Table/index.d.ts +1 -0
- package/lib/extensions/TaskList/TaskList.d.ts +11 -0
- package/lib/extensions/TaskList/components/RichTextTaskList.d.ts +1 -0
- package/lib/extensions/TaskList/index.d.ts +1 -0
- package/lib/extensions/TextAlign/TextAlign.d.ts +17 -0
- package/lib/extensions/TextAlign/components/RichTextAlign.d.ts +14 -0
- package/lib/extensions/TextAlign/index.d.ts +1 -0
- package/lib/extensions/TextDirection/TextDirection.d.ts +5 -0
- package/lib/extensions/TextDirection/components/RichTextTextDirection.d.ts +15 -0
- package/lib/extensions/TextDirection/index.d.ts +1 -0
- package/lib/extensions/TextUnderline/TextUnderline.d.ts +6 -0
- package/lib/extensions/TextUnderline/components/RichTextUnderline.d.ts +1 -0
- package/lib/extensions/TextUnderline/index.d.ts +1 -0
- package/lib/extensions/Twitter/Twitter.d.ts +46 -0
- package/lib/extensions/Twitter/components/FormEditLinkTwitter.d.ts +6 -0
- package/lib/extensions/Twitter/components/NodeViewTweet.d.ts +8 -0
- package/lib/extensions/Twitter/components/RichTextTwitter.d.ts +1 -0
- package/lib/extensions/Twitter/index.d.ts +1 -0
- package/lib/extensions/Video/Video.d.ts +66 -0
- package/lib/extensions/Video/components/RichTextVideo.d.ts +1 -0
- package/lib/extensions/Video/index.d.ts +1 -0
- package/lib/hooks/useActive.d.ts +21 -0
- package/lib/hooks/useAttributes.d.ts +2 -0
- package/lib/hooks/useButtonProps.d.ts +1 -0
- package/lib/hooks/useCopy.d.ts +5 -0
- package/lib/hooks/useExtension.d.ts +1 -0
- package/lib/hooks/useLocalStorage.d.ts +13 -0
- package/lib/index-4Q5IhypJ.js +1349 -0
- package/lib/index-BCzvbrf5.cjs +12 -0
- package/lib/index-BG0kQamI.js +285 -0
- package/lib/index-C-tDsIKJ.js +1631 -0
- package/lib/index-C1WCZhyA.js +237 -0
- package/lib/index-CjhjjJsN.cjs +1 -0
- package/lib/index-Cs6cp0Y6.cjs +1 -0
- package/lib/index-CsSfYR30.js +1351 -0
- package/lib/index-D9oM__YW.cjs +1 -0
- package/lib/index-DjDf4BK8.js +707 -0
- package/lib/index-NsYff_Ni.cjs +1 -0
- package/lib/index-bVGIXhRg.cjs +1 -0
- package/lib/index-lj3VWExo.js +4883 -0
- package/lib/index-neeeY2o7.cjs +4 -0
- package/lib/index.cjs +115 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +338 -0
- package/lib/jsx-runtime-CT7Pcg-t.js +13 -0
- package/lib/jsx-runtime-C_NLcKys.cjs +1 -0
- package/lib/lib/utils.d.ts +2 -0
- package/lib/locale-bundle.cjs +1 -0
- package/lib/locale-bundle.d.ts +1 -0
- package/lib/locale-bundle.js +11 -0
- package/lib/locales/en.d.ts +196 -0
- package/lib/locales/fi.d.ts +196 -0
- package/lib/locales/hu.d.ts +196 -0
- package/lib/locales/index.d.ts +1198 -0
- package/lib/locales/pt-br.d.ts +196 -0
- package/lib/locales/vi.d.ts +196 -0
- package/lib/locales/zh-cn.d.ts +196 -0
- package/lib/plugins/image-upload.d.ts +13 -0
- package/lib/popover-CPr9bHYn.js +24 -0
- package/lib/popover-D-hUKDYu.cjs +1 -0
- package/lib/renderNodeView-BJSrgyGj.js +28 -0
- package/lib/renderNodeView-DfLmGrgA.cjs +1 -0
- package/lib/select-C2KF4RNg.cjs +1 -0
- package/lib/select-CuE_HaQJ.js +120 -0
- package/lib/separator-CHzYNMVt.js +293 -0
- package/lib/separator-_gvUNba_.cjs +1 -0
- package/lib/store/EditorEditableReactive.d.ts +1 -0
- package/lib/store/ThemeColorReactive.d.ts +1 -0
- package/lib/store/commandList.d.ts +2 -0
- package/lib/store/editor.d.ts +21 -0
- package/lib/store/store.d.ts +3 -0
- package/lib/style.css +1 -0
- package/lib/textarea-DZj6EY-N.cjs +1 -0
- package/lib/textarea-gEoNp9CA.js +20 -0
- package/lib/theme/theme.d.ts +369 -0
- package/lib/theme.cjs +1 -0
- package/lib/theme.js +395 -0
- package/lib/types.d.ts +230 -0
- package/lib/updatePosition-Cjuj2E26.cjs +1 -0
- package/lib/updatePosition-e90ZrFWW.js +16 -0
- package/lib/utils/base64.d.ts +2 -0
- package/lib/utils/checkIsVideoUrl.d.ts +1 -0
- package/lib/utils/color.d.ts +7 -0
- package/lib/utils/columns.d.ts +14 -0
- package/lib/utils/customEvents/events.constant.d.ts +6 -0
- package/lib/utils/delete-node.d.ts +2 -0
- package/lib/utils/dom-dataset.d.ts +28 -0
- package/lib/utils/download.d.ts +1 -0
- package/lib/utils/dynamicCSS.d.ts +25 -0
- package/lib/utils/editor-container-size.d.ts +4 -0
- package/lib/utils/file.d.ts +30 -0
- package/lib/utils/getRenderContainer.d.ts +3 -0
- package/lib/utils/indent.d.ts +14 -0
- package/lib/utils/is-mobile.d.ts +19 -0
- package/lib/utils/json.d.ts +2 -0
- package/lib/utils/lru-cache.d.ts +31 -0
- package/lib/utils/mitt.d.ts +24 -0
- package/lib/utils/node.d.ts +15 -0
- package/lib/utils/pdf.d.ts +3 -0
- package/lib/utils/plateform.d.ts +11 -0
- package/lib/utils/renderNodeView.d.ts +6 -0
- package/lib/utils/shortId.d.ts +1 -0
- package/lib/utils/storage.d.ts +2 -0
- package/lib/utils/updatePosition.d.ts +1 -0
- package/lib/utils/utils.d.ts +20 -0
- package/lib/utils/validateFile.d.ts +16 -0
- package/package.json +845 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 hunghg255
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://www.npmjs.com/package/reactjs-tiptap-editor" target="_blank" rel="noopener noreferrer">
|
|
3
|
+
<img src="https://api.iconify.design/ic:round-wysiwyg.svg?color=%23bbdf58" alt="logo" width='100'/></a>
|
|
4
|
+
</p>
|
|
5
|
+
|
|
6
|
+
<p align="center">
|
|
7
|
+
A modern WYSIWYG rich-text editor base on Tiptap uses Shadcn components.
|
|
8
|
+
</p>
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+

|
|
13
|
+
|
|
14
|
+
## Run Locally
|
|
15
|
+
|
|
16
|
+
Clone the project
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
git clone https://github.com/hunghg255/reactjs-tiptap-editor.git
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Go to the project directory
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
cd reactjs-tiptap-editor
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Install dependencies
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pnpm install
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Start the Demo server
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm run build:lib:dev
|
|
38
|
+
npm run playground
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## All Contributors
|
|
42
|
+
|
|
43
|
+
Thanks to the following friends for their contributions to project:
|
|
44
|
+
|
|
45
|
+

|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
## Related
|
|
49
|
+
|
|
50
|
+
Here are some related projects
|
|
51
|
+
|
|
52
|
+
[Tiptap](https://tiptap.dev)
|
|
53
|
+
|
|
54
|
+
[Shadcn](https://ui.shadcn.com/)
|
|
55
|
+
|
|
56
|
+
## License
|
|
57
|
+
|
|
58
|
+
[MIT](./LICENSE)
|
|
59
|
+
|
|
60
|
+
## Versioning
|
|
61
|
+
|
|
62
|
+
This project was cloned from the original repository on version:1.0.17 of Jan 13.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsxs as c, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { Slot as n } from "@radix-ui/react-slot";
|
|
3
|
+
import r from "react";
|
|
4
|
+
import { i as d, T as m, a as f, B as s, b as u, g } from "./index-lj3VWExo.js";
|
|
5
|
+
import "./theme.js";
|
|
6
|
+
const C = r.forwardRef(
|
|
7
|
+
({ asChild: x = !1, tooltip: i, ...t }, l) => {
|
|
8
|
+
var a;
|
|
9
|
+
const h = d[t.icon];
|
|
10
|
+
return /* @__PURE__ */ c(m, { children: [
|
|
11
|
+
/* @__PURE__ */ e(f, { asChild: !0, children: /* @__PURE__ */ e(
|
|
12
|
+
x ? n : s,
|
|
13
|
+
{
|
|
14
|
+
className: "richtext-h-[32px] richtext-min-w-24 richtext-overflow-hidden richtext-px-[5px] richtext-py-0",
|
|
15
|
+
"data-state": t != null && t.dataState ? "on" : "off",
|
|
16
|
+
disabled: t == null ? void 0 : t.disabled,
|
|
17
|
+
ref: l,
|
|
18
|
+
variant: "ghost",
|
|
19
|
+
...t,
|
|
20
|
+
children: /* @__PURE__ */ c("div", { className: "richtext-flex richtext-h-full richtext-items-center richtext-font-normal", children: [
|
|
21
|
+
(t == null ? void 0 : t.title) && /* @__PURE__ */ e("div", { className: "richtext-grow richtext-truncate richtext-text-left richtext-text-sm", children: t == null ? void 0 : t.title }),
|
|
22
|
+
h && /* @__PURE__ */ e(h, { className: "richtext-ml-1 richtext-size-3 richtext-shrink-0 richtext-text-zinc-500" })
|
|
23
|
+
] })
|
|
24
|
+
}
|
|
25
|
+
) }),
|
|
26
|
+
i && /* @__PURE__ */ e(u, { children: /* @__PURE__ */ c("div", { className: "richtext-flex richtext-max-w-24 richtext-flex-col richtext-items-center richtext-text-center", children: [
|
|
27
|
+
i && /* @__PURE__ */ e("div", { children: i }),
|
|
28
|
+
/* @__PURE__ */ e("div", { className: "richtext-flex", children: !!((a = t == null ? void 0 : t.shortcutKeys) != null && a.length) && /* @__PURE__ */ e("span", { children: g(t == null ? void 0 : t.shortcutKeys) }) })
|
|
29
|
+
] }) })
|
|
30
|
+
] });
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
export {
|
|
34
|
+
C as A
|
|
35
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),a=require("@radix-ui/react-slot"),d=require("react"),i=require("./index-D9oM__YW.cjs");require("./theme.cjs");const s=d.forwardRef(({asChild:h=!1,tooltip:c,...t},l)=>{var n;const x=i.icons[t.icon],r=h?a.Slot:i.Button;return e.jsxs(i.Tooltip,{children:[e.jsx(i.TooltipTrigger,{asChild:!0,children:e.jsx(r,{className:"richtext-h-[32px] richtext-min-w-24 richtext-overflow-hidden richtext-px-[5px] richtext-py-0","data-state":t!=null&&t.dataState?"on":"off",disabled:t==null?void 0:t.disabled,ref:l,variant:"ghost",...t,children:e.jsxs("div",{className:"richtext-flex richtext-h-full richtext-items-center richtext-font-normal",children:[(t==null?void 0:t.title)&&e.jsx("div",{className:"richtext-grow richtext-truncate richtext-text-left richtext-text-sm",children:t==null?void 0:t.title}),x&&e.jsx(x,{className:"richtext-ml-1 richtext-size-3 richtext-shrink-0 richtext-text-zinc-500"})]})})}),c&&e.jsx(i.TooltipContent,{children:e.jsxs("div",{className:"richtext-flex richtext-max-w-24 richtext-flex-col richtext-items-center richtext-text-center",children:[c&&e.jsx("div",{children:c}),e.jsx("div",{className:"richtext-flex",children:!!((n=t==null?void 0:t.shortcutKeys)!=null&&n.length)&&e.jsx("span",{children:i.getShortcutKeys(t==null?void 0:t.shortcutKeys)})})]})})]})});exports.ActionMenuButton=s;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./clsx-CXbNJWDD.cjs"),s=require("./index-D9oM__YW.cjs"),e=require("react/jsx-runtime"),v=require("react");require("./theme.cjs");const x=require("lucide-react"),D=require("./index-bVGIXhRg.cjs"),u=require("./dom-dataset-BqoJhJXt.cjs"),S={audio:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-audio-lines"><path d="M2 10v3"/><path d="M6 6v11"/><path d="M10 3v18"/><path d="M14 8v7"/><path d="M18 5v13"/><path d="M22 10v3"/></svg>',video:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-video"><path d="m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5"/><rect x="2" y="6" width="14" height="12" rx="2"/></svg>',file:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-file"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/></svg>',image:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-image"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>',pdf:`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 32 32">
|
|
2
|
+
<path fill="currentColor" d="M30 18v-2h-6v10h2v-4h3v-2h-3v-2zm-11 8h-4V16h4a3.003 3.003 0 0 1 3 3v4a3.003 3.003 0 0 1-3 3m-2-2h2a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1h-2zm-6-8H6v10h2v-3h3a2.003 2.003 0 0 0 2-2v-3a2 2 0 0 0-2-2m-3 5v-3h3l.001 3z"></path>
|
|
3
|
+
<path fill="currentColor" d="M22 14v-4a.91.91 0 0 0-.3-.7l-7-7A.9.9 0 0 0 14 2H4a2.006 2.006 0 0 0-2 2v24a2 2 0 0 0 2 2h16v-2H4V4h8v6a2.006 2.006 0 0 0 2 2h6v2Zm-8-4V4.4l5.6 5.6Z"></path>
|
|
4
|
+
</svg>`,word:`<svg
|
|
5
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
6
|
+
width="1em"
|
|
7
|
+
height="1em"
|
|
8
|
+
className="icon"
|
|
9
|
+
viewBox="0 0 1024 1024"
|
|
10
|
+
>
|
|
11
|
+
<path
|
|
12
|
+
fill="currentColor"
|
|
13
|
+
d="M679.253 402.364 618.77 561.015l-60.348-158.651a30.04 30.04 0 0 0-30.447-18.637 29.76 29.76 0 0 0-30.447 18.637l-60.416 158.651-60.416-158.651a30.515 30.515 0 0 0-38.843-17.272 28.945 28.945 0 0 0-17.954 37.547l88.815 233.267c4.369 11.469 15.7 19.115 28.398 19.115a30.31 30.31 0 0 0 28.468-19.115l62.395-163.908 62.396 163.84c4.437 11.605 15.701 19.183 28.4 19.183a30.31 30.31 0 0 0 28.466-19.115l88.747-233.267a28.945 28.945 0 0 0-17.886-37.547 30.447 30.447 0 0 0-38.912 17.272zm219.478 395.605-51.883-29.218c-28.672-16.18-52.224-3.072-52.224 29.082v.273H643.209a29.833 29.833 0 0 0-30.31 29.354c0 16.18 13.584 29.218 30.31 29.218h151.825c1.092 30.516 24.03 43.077 52.224 27.648l51.063-27.989c29.013-15.906 29.15-42.189.41-58.368"
|
|
14
|
+
/>
|
|
15
|
+
<path
|
|
16
|
+
fill="currentColor"
|
|
17
|
+
d="m810.667 913.135-.478.068H201.796c-19.865 0-36.727-11.673-36.727-25.6v-618.36h154.965c51.268 0 92.911-39.39 92.911-87.858v-87.86H810.19c19.797 0 36.522 11.742 36.522 25.669V739.26h61.987V119.262c0-46.421-44.169-84.241-98.51-84.241H328.364l-225.28 194.56v658.09c0 46.285 44.236 84.105 98.713 84.105H810.19c43.759 0 80.554-24.713 93.32-58.573h-92.842zM350.89 94.89v86.562c0 16.11-13.858 29.286-30.925 29.286H216.815L350.959 94.891z"
|
|
18
|
+
/>
|
|
19
|
+
</svg>`,excel:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-sheet"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><line x1="3" x2="21" y1="9" y2="9"/><line x1="3" x2="21" y1="15" y2="15"/><line x1="9" x2="9" y1="9" y2="21"/><line x1="15" x2="15" y1="9" y2="21"/></svg>',ppt:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-table-properties"><path d="M15 3v18"/><rect width="18" height="18" x="3" y="3" rx="2"/><path d="M21 9H3"/><path d="M21 15H3"/></svg>'};function B(t){const n=S[t],l=new DOMParser().parseFromString(n,"image/svg+xml").documentElement,o=["svg",{...Array.from(l.attributes).reduce((r,a)=>(r[a.name]=a.value,r),{})}];return Array.from(l.childNodes).forEach(r=>{if(r.nodeType===1){const a=[r.tagName.toLowerCase(),Array.from(r.attributes).reduce((h,p)=>(h[p.name]=p.value,h),{})];r.textContent&&a.push(r.textContent),o.push(a)}}),o}const _={audio:e.jsx(x.LucideAudioLines,{}),video:e.jsx(x.LucideVideo,{}),file:e.jsx(x.LucideFile,{}),image:e.jsx(x.LucideImage,{}),pdf:e.jsx(s.ExportPdf,{}),word:e.jsx(s.ExportWord,{}),excel:e.jsx(x.LucideSheet,{}),ppt:e.jsx(x.LucideTableProperties,{})};function b(t,n=!1){const i=s.normalizeFileType(t),d=_[i]||e.jsx(e.Fragment,{});return n?B(i):d}const R="_wrap_15oj2_2",k={wrap:R};function q({editor:t,node:n,updateAttributes:i,deleteNode:d,extension:l}){var M;const o=v.useRef(null),r=s.useEditableEditor(),{hasTrigger:a,fileName:h,fileSize:p,fileExt:C,fileType:H,url:g,error:A}=n.attrs,[N,w]=v.useState(!1),{t:y}=D.useLocale(),z=(M=l==null?void 0:l.options)==null?void 0:M.upload,f=v.useCallback(()=>{!r||g||o.current.click()},[g,r]),E=v.useCallback(async T=>{const m=T.target.files&&T.target.files[0];if(!m)return;const V={fileName:s.extractFilename(m.name),fileSize:m.size,fileType:m.type,fileExt:s.extractFileExtension(m.name)};w(!0);try{const j=await z(m);i({...V,url:j}),w(!1)}catch(j){i({error:`File upload fail: ${j&&j.message}`}),w(!1),o.current.value=""}},[w,i]);v.useEffect(()=>{!g&&!a&&(f(),i({hasTrigger:!0}))},[g,a,f,i]);const F=v.useCallback(()=>d(),[t]);return r&&!g?e.jsx(c.NodeViewWrapper,{children:e.jsxs("div",{className:c.clsx(k.wrap,"render-wrapper"),children:[e.jsx("p",{onClick:f,style:{cursor:"pointer"},children:N?e.jsx("span",{children:y("editor.attachment.uploading")}):e.jsx("span",{children:y("editor.attachment.please_upload")})}),e.jsx("input",{hidden:!0,onChange:E,ref:o,type:"file"})]})}):g?e.jsx(c.NodeViewWrapper,{children:e.jsxs("div",{className:c.clsx(k.wrap,"render-wrapper"),onClick:f,children:[e.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-[4px]",children:[e.jsx("span",{children:b(H)}),e.jsxs("span",{children:[h,".",C]}),e.jsxs("span",{children:["(",s.normalizeFileSize(p),")"]})]}),r&&e.jsx(s.ActionButton,{action:F,icon:"Trash2",tooltip:y("editor.delete")})]})}):A!=="null"?e.jsx(c.NodeViewWrapper,{children:e.jsx("div",{className:c.clsx(k.wrap,"render-wrapper"),onClick:f,children:e.jsx("p",{children:A})})}):e.jsx(e.Fragment,{})}function P(){const t=s.useButtonProps(L.name),{icon:n=void 0,tooltip:i=void 0,shortcutKeys:d=void 0,tooltipOptions:l={},action:o=void 0,isActive:r=void 0}=(t==null?void 0:t.componentProps)??{},{editorDisabled:a,update:h}=s.useToggleActive(r),p=()=>{a||o&&(o(),h())};return t?e.jsx(s.ActionButton,{action:p,disabled:a,icon:n,shortcutKeys:d,tooltip:i,tooltipOptions:l}):e.jsx(e.Fragment,{})}const L=c.Node3.create({name:"attachment",content:"",marks:"",group:"block",selectable:!0,atom:!0,draggable:!0,addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),HTMLAttributes:{class:"attachment"},button:({editor:n,t:i})=>({component:s.ActionButton,componentProps:{action:()=>n.chain().focus().setAttachment().run(),isActive:()=>!1,disabled:!1,icon:"Attachment",tooltip:i("editor.attachment.tooltip")}})}},parseHTML(){return[{tag:"div[class=attachment]"}]},renderHTML({HTMLAttributes:t}){const{url:n="",fileName:i="",fileSize:d="",fileType:l="",fileExt:o=""}=t||{};return["div",c.mergeAttributes(this.options.HTMLAttributes||{},t||{}),n?["a",{href:n||"#"},["span",{class:"attachment__icon"},b(l,!0)],["span",{class:"attachment__text"},`${i}.${o} (${s.normalizeFileSize(d)})`]]:["div",{class:"attachment__placeholder"}]]},addAttributes(){return{fileName:{default:null,parseHTML:u.getDatasetAttribute("filename")},fileSize:{default:null,parseHTML:u.getDatasetAttribute("filesize")},fileType:{default:null,parseHTML:u.getDatasetAttribute("filetype")},fileExt:{default:null,parseHTML:u.getDatasetAttribute("fileext")},url:{default:null,parseHTML:u.getDatasetAttribute("url")},hasTrigger:{default:!1,parseHTML:t=>u.getDatasetAttribute("hastrigger")(t)==="true"},error:{default:null,parseHTML:u.getDatasetAttribute("error")}}},addCommands(){return{setAttachment:(t={})=>({chain:n})=>n().insertContent({type:this.name,attrs:t}).run()}},addNodeView(){return c.ReactNodeViewRenderer(q)}});exports.Attachment=L;exports.RichTextAttachment=P;
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
import { h as x, j as y, N as _, k as P, m as D } from "./clsx-CDyrfCnw.js";
|
|
2
|
+
import { K as R, N as $, O as I, J as O, P as Z, Q as K, R as N, A as T, u as W, d as J } from "./index-lj3VWExo.js";
|
|
3
|
+
import { jsx as e, Fragment as L, jsxs as f } from "react/jsx-runtime";
|
|
4
|
+
import { useRef as Q, useState as q, useCallback as k, useEffect as G } from "react";
|
|
5
|
+
import "./theme.js";
|
|
6
|
+
import { LucideTableProperties as U, LucideSheet as X, LucideImage as Y, LucideFile as ee, LucideVideo as te, LucideAudioLines as re } from "lucide-react";
|
|
7
|
+
import { u as ie } from "./index-4Q5IhypJ.js";
|
|
8
|
+
import { g as c } from "./dom-dataset-CIEeltF6.js";
|
|
9
|
+
const oe = {
|
|
10
|
+
audio: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-audio-lines"><path d="M2 10v3"/><path d="M6 6v11"/><path d="M10 3v18"/><path d="M14 8v7"/><path d="M18 5v13"/><path d="M22 10v3"/></svg>',
|
|
11
|
+
video: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-video"><path d="m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5"/><rect x="2" y="6" width="14" height="12" rx="2"/></svg>',
|
|
12
|
+
file: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-file"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/></svg>',
|
|
13
|
+
image: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-image"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>',
|
|
14
|
+
pdf: `<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 32 32">
|
|
15
|
+
<path fill="currentColor" d="M30 18v-2h-6v10h2v-4h3v-2h-3v-2zm-11 8h-4V16h4a3.003 3.003 0 0 1 3 3v4a3.003 3.003 0 0 1-3 3m-2-2h2a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1h-2zm-6-8H6v10h2v-3h3a2.003 2.003 0 0 0 2-2v-3a2 2 0 0 0-2-2m-3 5v-3h3l.001 3z"></path>
|
|
16
|
+
<path fill="currentColor" d="M22 14v-4a.91.91 0 0 0-.3-.7l-7-7A.9.9 0 0 0 14 2H4a2.006 2.006 0 0 0-2 2v24a2 2 0 0 0 2 2h16v-2H4V4h8v6a2.006 2.006 0 0 0 2 2h6v2Zm-8-4V4.4l5.6 5.6Z"></path>
|
|
17
|
+
</svg>`,
|
|
18
|
+
word: `<svg
|
|
19
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
20
|
+
width="1em"
|
|
21
|
+
height="1em"
|
|
22
|
+
className="icon"
|
|
23
|
+
viewBox="0 0 1024 1024"
|
|
24
|
+
>
|
|
25
|
+
<path
|
|
26
|
+
fill="currentColor"
|
|
27
|
+
d="M679.253 402.364 618.77 561.015l-60.348-158.651a30.04 30.04 0 0 0-30.447-18.637 29.76 29.76 0 0 0-30.447 18.637l-60.416 158.651-60.416-158.651a30.515 30.515 0 0 0-38.843-17.272 28.945 28.945 0 0 0-17.954 37.547l88.815 233.267c4.369 11.469 15.7 19.115 28.398 19.115a30.31 30.31 0 0 0 28.468-19.115l62.395-163.908 62.396 163.84c4.437 11.605 15.701 19.183 28.4 19.183a30.31 30.31 0 0 0 28.466-19.115l88.747-233.267a28.945 28.945 0 0 0-17.886-37.547 30.447 30.447 0 0 0-38.912 17.272zm219.478 395.605-51.883-29.218c-28.672-16.18-52.224-3.072-52.224 29.082v.273H643.209a29.833 29.833 0 0 0-30.31 29.354c0 16.18 13.584 29.218 30.31 29.218h151.825c1.092 30.516 24.03 43.077 52.224 27.648l51.063-27.989c29.013-15.906 29.15-42.189.41-58.368"
|
|
28
|
+
/>
|
|
29
|
+
<path
|
|
30
|
+
fill="currentColor"
|
|
31
|
+
d="m810.667 913.135-.478.068H201.796c-19.865 0-36.727-11.673-36.727-25.6v-618.36h154.965c51.268 0 92.911-39.39 92.911-87.858v-87.86H810.19c19.797 0 36.522 11.742 36.522 25.669V739.26h61.987V119.262c0-46.421-44.169-84.241-98.51-84.241H328.364l-225.28 194.56v658.09c0 46.285 44.236 84.105 98.713 84.105H810.19c43.759 0 80.554-24.713 93.32-58.573h-92.842zM350.89 94.89v86.562c0 16.11-13.858 29.286-30.925 29.286H216.815L350.959 94.891z"
|
|
32
|
+
/>
|
|
33
|
+
</svg>`,
|
|
34
|
+
excel: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-sheet"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><line x1="3" x2="21" y1="9" y2="9"/><line x1="3" x2="21" y1="15" y2="15"/><line x1="9" x2="9" y1="9" y2="21"/><line x1="15" x2="15" y1="9" y2="21"/></svg>',
|
|
35
|
+
ppt: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-table-properties"><path d="M15 3v18"/><rect width="18" height="18" x="3" y="3" rx="2"/><path d="M21 9H3"/><path d="M21 15H3"/></svg>'
|
|
36
|
+
};
|
|
37
|
+
function ne(t) {
|
|
38
|
+
const o = oe[t], s = new DOMParser().parseFromString(o, "image/svg+xml").documentElement, n = [
|
|
39
|
+
"svg",
|
|
40
|
+
{
|
|
41
|
+
...Array.from(s.attributes).reduce((r, a) => (r[a.name] = a.value, r), {})
|
|
42
|
+
}
|
|
43
|
+
];
|
|
44
|
+
return Array.from(s.childNodes).forEach((r) => {
|
|
45
|
+
if (r.nodeType === 1) {
|
|
46
|
+
const a = [
|
|
47
|
+
r.tagName.toLowerCase(),
|
|
48
|
+
Array.from(r.attributes).reduce((d, h) => (d[h.name] = h.value, d), {})
|
|
49
|
+
];
|
|
50
|
+
r.textContent && a.push(r.textContent), n.push(a);
|
|
51
|
+
}
|
|
52
|
+
}), n;
|
|
53
|
+
}
|
|
54
|
+
const ae = {
|
|
55
|
+
audio: /* @__PURE__ */ e(re, {}),
|
|
56
|
+
video: /* @__PURE__ */ e(te, {}),
|
|
57
|
+
file: /* @__PURE__ */ e(ee, {}),
|
|
58
|
+
image: /* @__PURE__ */ e(Y, {}),
|
|
59
|
+
pdf: /* @__PURE__ */ e(I, {}),
|
|
60
|
+
word: /* @__PURE__ */ e($, {}),
|
|
61
|
+
excel: /* @__PURE__ */ e(X, {}),
|
|
62
|
+
ppt: /* @__PURE__ */ e(U, {})
|
|
63
|
+
};
|
|
64
|
+
function b(t, o = !1) {
|
|
65
|
+
const i = R(t), l = ae[i] || /* @__PURE__ */ e(L, {});
|
|
66
|
+
return o ? ne(i) : l;
|
|
67
|
+
}
|
|
68
|
+
const se = "_wrap_15oj2_2", M = {
|
|
69
|
+
wrap: se
|
|
70
|
+
};
|
|
71
|
+
function le({
|
|
72
|
+
editor: t,
|
|
73
|
+
node: o,
|
|
74
|
+
updateAttributes: i,
|
|
75
|
+
deleteNode: l,
|
|
76
|
+
extension: s
|
|
77
|
+
}) {
|
|
78
|
+
var A;
|
|
79
|
+
const n = Q(null), r = O(), { hasTrigger: a, fileName: d, fileSize: h, fileExt: z, fileType: E, url: u, error: H } = o.attrs, [F, v] = q(!1), { t: w } = ie(), V = (A = s == null ? void 0 : s.options) == null ? void 0 : A.upload, m = k(() => {
|
|
80
|
+
!r || u || n.current.click();
|
|
81
|
+
}, [u, r]), j = k(
|
|
82
|
+
async (C) => {
|
|
83
|
+
const p = C.target.files && C.target.files[0];
|
|
84
|
+
if (!p) return;
|
|
85
|
+
const S = {
|
|
86
|
+
fileName: K(p.name),
|
|
87
|
+
fileSize: p.size,
|
|
88
|
+
fileType: p.type,
|
|
89
|
+
fileExt: Z(p.name)
|
|
90
|
+
};
|
|
91
|
+
v(!0);
|
|
92
|
+
try {
|
|
93
|
+
const g = await V(p);
|
|
94
|
+
i({ ...S, url: g }), v(!1);
|
|
95
|
+
} catch (g) {
|
|
96
|
+
i({
|
|
97
|
+
error: `File upload fail: ${g && g.message}`
|
|
98
|
+
}), v(!1), n.current.value = "";
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
[v, i]
|
|
102
|
+
);
|
|
103
|
+
G(() => {
|
|
104
|
+
!u && !a && (m(), i({ hasTrigger: !0 }));
|
|
105
|
+
}, [u, a, m, i]);
|
|
106
|
+
const B = k(() => l(), [t]);
|
|
107
|
+
return r && !u ? /* @__PURE__ */ e(x, { children: /* @__PURE__ */ f("div", { className: y(M.wrap, "render-wrapper"), children: [
|
|
108
|
+
/* @__PURE__ */ e("p", { onClick: m, style: { cursor: "pointer" }, children: F ? /* @__PURE__ */ e("span", { children: w("editor.attachment.uploading") }) : /* @__PURE__ */ e("span", { children: w("editor.attachment.please_upload") }) }),
|
|
109
|
+
/* @__PURE__ */ e("input", { hidden: !0, onChange: j, ref: n, type: "file" })
|
|
110
|
+
] }) }) : u ? /* @__PURE__ */ e(x, { children: /* @__PURE__ */ f(
|
|
111
|
+
"div",
|
|
112
|
+
{
|
|
113
|
+
className: y(M.wrap, "render-wrapper"),
|
|
114
|
+
onClick: m,
|
|
115
|
+
children: [
|
|
116
|
+
/* @__PURE__ */ f("div", { className: "richtext-flex richtext-items-center richtext-gap-[4px]", children: [
|
|
117
|
+
/* @__PURE__ */ e("span", { children: b(E) }),
|
|
118
|
+
/* @__PURE__ */ f("span", { children: [
|
|
119
|
+
d,
|
|
120
|
+
".",
|
|
121
|
+
z
|
|
122
|
+
] }),
|
|
123
|
+
/* @__PURE__ */ f("span", { children: [
|
|
124
|
+
"(",
|
|
125
|
+
N(h),
|
|
126
|
+
")"
|
|
127
|
+
] })
|
|
128
|
+
] }),
|
|
129
|
+
r && /* @__PURE__ */ e(
|
|
130
|
+
T,
|
|
131
|
+
{
|
|
132
|
+
action: B,
|
|
133
|
+
icon: "Trash2",
|
|
134
|
+
tooltip: w("editor.delete")
|
|
135
|
+
}
|
|
136
|
+
)
|
|
137
|
+
]
|
|
138
|
+
}
|
|
139
|
+
) }) : H !== "null" ? /* @__PURE__ */ e(x, { children: /* @__PURE__ */ e(
|
|
140
|
+
"div",
|
|
141
|
+
{
|
|
142
|
+
className: y(M.wrap, "render-wrapper"),
|
|
143
|
+
onClick: m,
|
|
144
|
+
children: /* @__PURE__ */ e("p", { children: H })
|
|
145
|
+
}
|
|
146
|
+
) }) : /* @__PURE__ */ e(L, {});
|
|
147
|
+
}
|
|
148
|
+
function we() {
|
|
149
|
+
const t = W(ce.name), {
|
|
150
|
+
icon: o = void 0,
|
|
151
|
+
tooltip: i = void 0,
|
|
152
|
+
shortcutKeys: l = void 0,
|
|
153
|
+
tooltipOptions: s = {},
|
|
154
|
+
action: n = void 0,
|
|
155
|
+
isActive: r = void 0
|
|
156
|
+
} = (t == null ? void 0 : t.componentProps) ?? {}, { editorDisabled: a, update: d } = J(r), h = () => {
|
|
157
|
+
a || n && (n(), d());
|
|
158
|
+
};
|
|
159
|
+
return t ? /* @__PURE__ */ e(
|
|
160
|
+
T,
|
|
161
|
+
{
|
|
162
|
+
action: h,
|
|
163
|
+
disabled: a,
|
|
164
|
+
icon: o,
|
|
165
|
+
shortcutKeys: l,
|
|
166
|
+
tooltip: i,
|
|
167
|
+
tooltipOptions: s
|
|
168
|
+
}
|
|
169
|
+
) : /* @__PURE__ */ e(L, {});
|
|
170
|
+
}
|
|
171
|
+
const ce = /* @__PURE__ */ _.create({
|
|
172
|
+
name: "attachment",
|
|
173
|
+
content: "",
|
|
174
|
+
marks: "",
|
|
175
|
+
group: "block",
|
|
176
|
+
selectable: !0,
|
|
177
|
+
atom: !0,
|
|
178
|
+
draggable: !0,
|
|
179
|
+
//@ts-expect-error
|
|
180
|
+
addOptions() {
|
|
181
|
+
var t;
|
|
182
|
+
return {
|
|
183
|
+
...(t = this.parent) == null ? void 0 : t.call(this),
|
|
184
|
+
HTMLAttributes: {
|
|
185
|
+
class: "attachment"
|
|
186
|
+
},
|
|
187
|
+
button: ({ editor: o, t: i }) => ({
|
|
188
|
+
component: T,
|
|
189
|
+
componentProps: {
|
|
190
|
+
action: () => o.chain().focus().setAttachment().run(),
|
|
191
|
+
isActive: () => !1,
|
|
192
|
+
disabled: !1,
|
|
193
|
+
icon: "Attachment",
|
|
194
|
+
tooltip: i("editor.attachment.tooltip")
|
|
195
|
+
}
|
|
196
|
+
})
|
|
197
|
+
};
|
|
198
|
+
},
|
|
199
|
+
parseHTML() {
|
|
200
|
+
return [{ tag: "div[class=attachment]" }];
|
|
201
|
+
},
|
|
202
|
+
renderHTML({ HTMLAttributes: t }) {
|
|
203
|
+
const {
|
|
204
|
+
url: o = "",
|
|
205
|
+
fileName: i = "",
|
|
206
|
+
fileSize: l = "",
|
|
207
|
+
fileType: s = "",
|
|
208
|
+
fileExt: n = ""
|
|
209
|
+
} = t || {};
|
|
210
|
+
return [
|
|
211
|
+
"div",
|
|
212
|
+
D(
|
|
213
|
+
// @ts-expect-error
|
|
214
|
+
this.options.HTMLAttributes || {},
|
|
215
|
+
t || {}
|
|
216
|
+
),
|
|
217
|
+
o ? [
|
|
218
|
+
"a",
|
|
219
|
+
{ href: o || "#" },
|
|
220
|
+
["span", { class: "attachment__icon" }, b(s, !0)],
|
|
221
|
+
[
|
|
222
|
+
"span",
|
|
223
|
+
{ class: "attachment__text" },
|
|
224
|
+
`${i}.${n} (${N(l)})`
|
|
225
|
+
]
|
|
226
|
+
] : ["div", { class: "attachment__placeholder" }]
|
|
227
|
+
];
|
|
228
|
+
},
|
|
229
|
+
addAttributes() {
|
|
230
|
+
return {
|
|
231
|
+
fileName: {
|
|
232
|
+
default: null,
|
|
233
|
+
parseHTML: c("filename")
|
|
234
|
+
},
|
|
235
|
+
fileSize: {
|
|
236
|
+
default: null,
|
|
237
|
+
parseHTML: c("filesize")
|
|
238
|
+
},
|
|
239
|
+
fileType: {
|
|
240
|
+
default: null,
|
|
241
|
+
parseHTML: c("filetype")
|
|
242
|
+
},
|
|
243
|
+
fileExt: {
|
|
244
|
+
default: null,
|
|
245
|
+
parseHTML: c("fileext")
|
|
246
|
+
},
|
|
247
|
+
url: {
|
|
248
|
+
default: null,
|
|
249
|
+
parseHTML: c("url")
|
|
250
|
+
},
|
|
251
|
+
hasTrigger: {
|
|
252
|
+
default: !1,
|
|
253
|
+
parseHTML: (t) => c("hastrigger")(t) === "true"
|
|
254
|
+
},
|
|
255
|
+
error: {
|
|
256
|
+
default: null,
|
|
257
|
+
parseHTML: c("error")
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
},
|
|
261
|
+
addCommands() {
|
|
262
|
+
return {
|
|
263
|
+
setAttachment: (t = {}) => ({ chain: o }) => o().insertContent({ type: this.name, attrs: t }).run()
|
|
264
|
+
};
|
|
265
|
+
},
|
|
266
|
+
addNodeView() {
|
|
267
|
+
return P(le);
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
export {
|
|
271
|
+
ce as Attachment,
|
|
272
|
+
we as RichTextAttachment
|
|
273
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./clsx-CXbNJWDD.cjs"),p=require("./jsx-runtime-C_NLcKys.cjs"),l=require("react/jsx-runtime"),a=require("./index-D9oM__YW.cjs");require("react");require("./theme.cjs");var g=/^\s*>\s$/,m=c.Node3.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return p.h("blockquote",{...c.mergeAttributes(this.options.HTMLAttributes,t),children:p.h("slot",{})})},parseMarkdown:(t,e)=>e.createNode("blockquote",void 0,e.parseChildren(t.tokens||[])),renderMarkdown:(t,e)=>{if(!t.content)return"";const o=">",n=[];return t.content.forEach(i=>{const u=e.renderChildren([i]).split(`
|
|
2
|
+
`).map(r=>r.trim()===""?o:`${o} ${r}`);n.push(u.join(`
|
|
3
|
+
`))}),n.join(`
|
|
4
|
+
${o}
|
|
5
|
+
`)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[c.wrappingInputRule({find:g,type:this.type})]}});function b(){const t=a.useButtonProps(h.name),{icon:e=void 0,tooltip:o=void 0,shortcutKeys:n=void 0,tooltipOptions:i={},action:s=void 0,isActive:d=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:u,disabled:r,update:q}=a.useToggleActive(d),k=()=>{r||s&&(s(),q())};return t?l.jsx(a.ActionButton,{action:k,dataState:u,disabled:r,icon:e,shortcutKeys:n,tooltip:o,tooltipOptions:i}):l.jsx(l.Fragment,{})}const h=m.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),HTMLAttributes:{class:"blockquote"},button:({editor:e,t:o,extension:n})=>({componentProps:{action:()=>e.commands.toggleBlockquote(),isActive:()=>e.isActive("blockquote"),disabled:!e.can().toggleBlockquote(),icon:"TextQuote",shortcutKeys:n.options.shortcutKeys??["shift","mod","B"],tooltip:o("editor.blockquote.tooltip")}})}}});exports.Blockquote=h;exports.RichTextBlockquote=b;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { N as m, w as h, m as k } from "./clsx-CDyrfCnw.js";
|
|
2
|
+
import { h as a } from "./jsx-runtime-CT7Pcg-t.js";
|
|
3
|
+
import { jsx as d, Fragment as g } from "react/jsx-runtime";
|
|
4
|
+
import { u as f, d as b, A as q } from "./index-lj3VWExo.js";
|
|
5
|
+
import "react";
|
|
6
|
+
import "./theme.js";
|
|
7
|
+
var v = /^\s*>\s$/, B = m.create({
|
|
8
|
+
name: "blockquote",
|
|
9
|
+
addOptions() {
|
|
10
|
+
return {
|
|
11
|
+
HTMLAttributes: {}
|
|
12
|
+
};
|
|
13
|
+
},
|
|
14
|
+
content: "block+",
|
|
15
|
+
group: "block",
|
|
16
|
+
defining: !0,
|
|
17
|
+
parseHTML() {
|
|
18
|
+
return [{ tag: "blockquote" }];
|
|
19
|
+
},
|
|
20
|
+
renderHTML({ HTMLAttributes: t }) {
|
|
21
|
+
return /* @__PURE__ */ a("blockquote", { ...k(this.options.HTMLAttributes, t), children: /* @__PURE__ */ a("slot", {}) });
|
|
22
|
+
},
|
|
23
|
+
parseMarkdown: (t, o) => o.createNode("blockquote", void 0, o.parseChildren(t.tokens || [])),
|
|
24
|
+
renderMarkdown: (t, o) => {
|
|
25
|
+
if (!t.content)
|
|
26
|
+
return "";
|
|
27
|
+
const e = ">", n = [];
|
|
28
|
+
return t.content.forEach((i) => {
|
|
29
|
+
const c = o.renderChildren([i]).split(`
|
|
30
|
+
`).map((r) => r.trim() === "" ? e : `${e} ${r}`);
|
|
31
|
+
n.push(c.join(`
|
|
32
|
+
`));
|
|
33
|
+
}), n.join(`
|
|
34
|
+
${e}
|
|
35
|
+
`);
|
|
36
|
+
},
|
|
37
|
+
addCommands() {
|
|
38
|
+
return {
|
|
39
|
+
setBlockquote: () => ({ commands: t }) => t.wrapIn(this.name),
|
|
40
|
+
toggleBlockquote: () => ({ commands: t }) => t.toggleWrap(this.name),
|
|
41
|
+
unsetBlockquote: () => ({ commands: t }) => t.lift(this.name)
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
addKeyboardShortcuts() {
|
|
45
|
+
return {
|
|
46
|
+
"Mod-Shift-b": () => this.editor.commands.toggleBlockquote()
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
addInputRules() {
|
|
50
|
+
return [
|
|
51
|
+
h({
|
|
52
|
+
find: v,
|
|
53
|
+
type: this.type
|
|
54
|
+
})
|
|
55
|
+
];
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
function H() {
|
|
59
|
+
const t = f(A.name), {
|
|
60
|
+
icon: o = void 0,
|
|
61
|
+
tooltip: e = void 0,
|
|
62
|
+
shortcutKeys: n = void 0,
|
|
63
|
+
tooltipOptions: i = {},
|
|
64
|
+
action: s = void 0,
|
|
65
|
+
isActive: u = void 0
|
|
66
|
+
} = (t == null ? void 0 : t.componentProps) ?? {}, { dataState: c, disabled: r, update: l } = b(u), p = () => {
|
|
67
|
+
r || s && (s(), l());
|
|
68
|
+
};
|
|
69
|
+
return t ? /* @__PURE__ */ d(
|
|
70
|
+
q,
|
|
71
|
+
{
|
|
72
|
+
action: p,
|
|
73
|
+
dataState: c,
|
|
74
|
+
disabled: r,
|
|
75
|
+
icon: o,
|
|
76
|
+
shortcutKeys: n,
|
|
77
|
+
tooltip: e,
|
|
78
|
+
tooltipOptions: i
|
|
79
|
+
}
|
|
80
|
+
) : /* @__PURE__ */ d(g, {});
|
|
81
|
+
}
|
|
82
|
+
const A = /* @__PURE__ */ B.extend({
|
|
83
|
+
//@ts-expect-error
|
|
84
|
+
addOptions() {
|
|
85
|
+
var t;
|
|
86
|
+
return {
|
|
87
|
+
...(t = this.parent) == null ? void 0 : t.call(this),
|
|
88
|
+
HTMLAttributes: {
|
|
89
|
+
class: "blockquote"
|
|
90
|
+
},
|
|
91
|
+
button: ({ editor: o, t: e, extension: n }) => ({
|
|
92
|
+
componentProps: {
|
|
93
|
+
action: () => o.commands.toggleBlockquote(),
|
|
94
|
+
isActive: () => o.isActive("blockquote"),
|
|
95
|
+
disabled: !o.can().toggleBlockquote(),
|
|
96
|
+
icon: "TextQuote",
|
|
97
|
+
shortcutKeys: n.options.shortcutKeys ?? ["shift", "mod", "B"],
|
|
98
|
+
tooltip: e("editor.blockquote.tooltip")
|
|
99
|
+
}
|
|
100
|
+
})
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
export {
|
|
105
|
+
A as Blockquote,
|
|
106
|
+
H as RichTextBlockquote
|
|
107
|
+
};
|
package/lib/Bold.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./clsx-CXbNJWDD.cjs"),u=require("./jsx-runtime-C_NLcKys.cjs"),r=require("./index-D9oM__YW.cjs"),i=require("react/jsx-runtime");require("react");require("./theme.cjs");var y=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,_=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,B=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,k=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,v=o.Mark.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return u.h("strong",{...o.mergeAttributes(this.options.HTMLAttributes,t),children:u.h("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[o.markInputRule({find:y,type:this.type}),o.markInputRule({find:B,type:this.type})]},addPasteRules(){return[o.markPasteRule({find:_,type:this.type}),o.markPasteRule({find:k,type:this.type})]}});function M(){const t=r.useButtonProps(l.name),{icon:e=void 0,tooltip:n=void 0,shortcutKeys:s=void 0,tooltipOptions:c={},action:a=void 0,isActive:p=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:g,disabled:d,update:m}=r.useToggleActive(p),h=()=>{d||a&&(a(),m())};return t?i.jsx(r.ActionButton,{action:h,dataState:g,disabled:d,icon:e,shortcutKeys:s,tooltip:n,tooltipOptions:c}):i.jsx(i.Fragment,{})}const l=v.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:n,extension:s})=>({component:r.ActionButton,componentProps:{action:()=>e.commands.toggleBold(),isActive:()=>e.isActive("bold"),icon:"Bold",shortcutKeys:s.options.shortcutKeys??["mod","B"],tooltip:n("editor.bold.tooltip")}})}}});exports.Bold=l;exports.RichTextBold=M;
|